package com.znjc.device.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.znjc.device.domain.DeviceCommandRef;
import com.znjc.device.domain.DeviceTypeSerialRef;
import com.znjc.device.mapper.DeviceCommandRefMapper;
import com.znjc.device.service.IDeviceCommandRefService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author zengpc
 * @date 2023-12-04
 */
@Service
public class DeviceCommandRefServiceImpl extends ServiceImpl<DeviceCommandRefMapper, DeviceCommandRef> implements IDeviceCommandRefService {

    @Override
    public List<Long> getIdList(Long typeId) {
        LambdaQueryWrapper<DeviceCommandRef> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(DeviceCommandRef::getTypeId,typeId);
        List<DeviceCommandRef> list = this.list(wrapper);
        if(CollectionUtils.isNotEmpty(list)){
            return list.stream().map(DeviceCommandRef::getCommandId).collect(Collectors.toList());
        }
        return null;
    }
}
